import { Styled } from "../itag/Styled.js";

const [styled] = Styled.new();

export const sheet = styled.sheet;

export const name = styled.class("name")`
    margin-top: 0.2em;
    font-size: 0.8em;
    text-align: center;
`;

export const inputs = styled.class("inputs")`
    height: 1.8em;
`;

export const range = styled.class("range")`
    font-size: 0.8em;

    &::before {
        content: "[";
    }

    &::after {
        content: ")";
    }
`;

export const input = styled.class("input")`
    box-sizing: border-box;
    border: none;
    border-bottom: 1px solid #666;
    font-size: 1.2em;
    height: 1.6em;
    margin: 0 0.1em;
    outline: none;
    text-align: center;

    &[readonly] {
        border-bottom: 1px solid #ccc;
        cursor: not-allowed;
        color: #999;
    }
`;

export const number = styled.class("number")`
    width: 1.6em;
`;

export const string = styled.class("string")`
    width: 12em;
`;

export const field = styled.class("field")`
    display: flex;
    flex-direction: column;

    input {
        box-sizing: border-box;
        border: none;
        border-bottom: 1px solid #666;
        font-size: 1.2em;
        height: 1.6em;
        margin: 0 0.1em;
        outline: none;
        text-align: center;
        width: 2em;

        &[readonly] {
            cursor: not-allowed;
            border-bottom: 1px solid #ccc;
        }
    }
`;

export const enumAll = styled.class("enum-value")`
    box-sizing: border-box;
    border: none;
    border-bottom: 1px solid #666;
    cursor: pointer;
    font-size: 1.2em;
    height: 1.6em;
    margin: 0 0.1em;
    outline: none;
    position: relative;
    text-align: center;

    &:hover {
        background-color: #eee;
    }

    &:hover .options {
        visibility: visible;
        height: auto;
        max-height: 400px;
        transition: max-height 0.5s ease;
    }

    .options{
        background-color: #fff;
        box-shadow: 0 0 5px #999;
        display: flex;
        flex-direction: column;
        gap: 2px;
        font-size: 0.8em;
        padding: 2px;
        position: absolute;
        top: calc(100% + 0px);
        text-align: left;
        white-space: nowrap;
        height: 0;
        max-height: 0;
        visibility: hidden;
        overflow: hidden;
        transition: max-height 0.5s ease;
    }

    .options > div {
        cursor: pointer;
        line-height: 1.6em;
        padding: 0 1em 0 0.6em;
        user-select: none;
    }

    .options > div:hover {
        background-color: #eee;
    }

    .options.visible {
        display: flex;
    }

`;
